
# # 展开
# for i in range(28):
#     path="traces/YCSB-fold/YCSB-"+str(i)+".txt"
#     print(path)
#     file=open(path)

#     new_path="traces/YCSB-unfold0/YCSB-"+str(i)+".txt"
#     print(new_path)
#     new_file=open(new_path,mode='a+')

#     for line in file:
#         line=line.split("+")
        
#         begin=int(line[0])
#         size=int(line[1])

#         for i in range(size):
#             new_file.write(str(begin+i))
#             new_file.write("\n")


# # 采样
# for i in range(28):
#     path="traces/YCSB-unfold0/YCSB-"+str(i)+".txt"
#     print(path)
#     file=open(path)

#     new_path="traces/YCSB-unfold0/YCSB-sample-1000000/YCSB-"+str(i)+".txt"
#     print(new_path)
#     new_file=open(new_path,mode='a+')

#     j=0
#     for line in file:
#         if j>1000000:
#             break
#         new_file.write(line) 
#         j=j+1


# =============== MSR ========================
# path="traces/MSR/CAMRESHMSA01-lvm0.txt"
# old_file=open(path)
# number={}
# # j=0
# for line in old_file:
#     # if j>10:
#     #     break
#     # print(line)
#     line=line.split(',')
#     # print(line)
#     if line[3]!="Read":
#         continue

#     start=int(int(line[4])/4096)
#     size=0
#     if int(line[5])<4096:
#         size=0
#     else:
#         size=int(int(line[5])/4096)
#     # print(start,size)
#     new_path="traces/MSR/"+line[1]+line[2]+".txt"
#     new_file=open(new_path,mode='a+')

#     for i in range(size):
#         new_file.write(str(start+i))
#         new_file.write('\n')

#     # new_file.write(str(start))
#     # new_file.write("\n")
#     # j=j+1

# # -----------正采样----------------
# path="traces/MSR/proj2.txt"
# old_file=open(path)

# new_path="traces/MSR/proj2_inverse_sample100000.txt"
# new_file=open(new_path,mode='a+')
# j=0
# for line in old_file:
#     j=j+1
#     if j <100000:
#         pass
#     new_file.write(line)


    
count = -1
old_path="traces/MSR/prxy1.txt"
old_file=open(old_path)
new_path="traces/MSR/prxy1_inverse_sample100000.txt"
new_file=open(new_path,mode='a+')

# for count,line in enumerate(old_file):
#     pass
#     count += 1
# print(count)

# begin=count-100000
begin=336307520
print("begin is ",begin)
j=0
old_file.seek(0,0)
for line in old_file:
    j=j+1
    if j<=begin:
        continue
    new_file.write(line)
